import JSEncrypt from "@/node_modules/jsencrypt/bin/jsencrypt.js"
//公钥
let publicKey = 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAt5ZKZ8tr3tdC7Eh5KE1yU922xRO2HZNvLqJBwnXqTwoYqeOw5JsNVwNY/2VFkHyR+wWqiAnRNxPGwwx0wiSrVIO6ae/Yo8l5Li9fukEwQ6Se079AJlLY9CZucIkny2Nus0Bi4sDoLDg4KJ0QFXkSR5MyJvla69cpL93IMZ1JSPp/jgIvxEe7lFWRpqi/r2Icx/RCjXFOIBTNcLqAxzVUaGeFtNa7HjeUWXbdgtnvgsDcwd7onLJAmtdCD/0bDbmhb4nwHEg7ljr/ruue2Ou8gg1ujsxJjfHLVE4+knMwTaF6Ph3DWtpSjfoSKr7BRoHdC0v2GxLAALYF+kUp6qWSywIDAQAB'
//私钥
let privateKey = 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAt5ZKZ8tr3tdC7Eh5KE1yU922xRO2HZNvLqJBwnXqTwoYqeOw5JsNVwNY/2VFkHyR+wWqiAnRNxPGwwx0wiSrVIO6ae/Yo8l5Li9fukEwQ6Se079AJlLY9CZucIkny2Nus0Bi4sDoLDg4KJ0QFXkSR5MyJvla69cpL93IMZ1JSPp/jgIvxEe7lFWRpqi/r2Icx/RCjXFOIBTNcLqAxzVUaGeFtNa7HjeUWXbdgtnvgsDcwd7onLJAmtdCD/0bDbmhb4nwHEg7ljr/ruue2Ou8gg1ujsxJjfHLVE4+knMwTaF6Ph3DWtpSjfoSKr7BRoHdC0v2GxLAALYF+kUp6qWSywIDAQAB'
const encryptor = new JSEncrypt();
//RSA设置公钥
export function rsa_setPublicKey(word) {
	publicKey = word;
	encryptor.setPublicKey(publicKey);
}
 
//RSA加密
export function rsa_encrypt(word) {
    return encryptor.encrypt(word);
}
 
//RSA设置私钥
export function rsa_setPrivateKey(word) {
	privateKey = word;
	encryptor.setPrivateKey(privateKey);
}
 
//RSA解密
export function rsa_decrypt(word) {
    return encryptor.decrypt(word);
}